<?php

namespace app\api\controller;

use think\Controller;

class Introduce extends Controller
{
    //留学介绍和留学优势
    public function introduce()
    {
        $in = model('common/Introduce')
            -> where('id',1)
            -> field('title,content')
            -> find();
        $ins = model('common/Introduces')
            -> field('names,img,motto')
            -> select();
        if ($in && $ins){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$in,'date'=>$ins]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }

    //留学费用
    public function introduce_cost()
    {
        $in = model('common/Introduce')
            -> where('id',2)
            -> field('title,content')
            -> find();
        if ($in){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$in]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }

    //日本就业
    public function introduce_job()
    {
        $in = model('common/Introduce')
            -> where('id',3)
            -> field('title,author,num,content')
            -> find();
        $in -> setInc('num');
        if ($in){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$in]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }

    //全局展望
    public function introduce_look()
    {
        $in = model('common/Introduce')
            -> where('id',4)
            -> field('title,author,num,content')
            -> find();
        $in -> setInc('num');
        if ($in){
            return json(['code'=>100,'msg'=>'请求成功！','data'=>$in]);
        } else {
            return json(['code'=>404,'msg'=>'请求失败！']);
        }
    }

}
